//
//  TTSpecialViewCell.m
//  TaoTuo
//
//  Created by LG on 2020/10/19.
//  Copyright © 2020 刘广. All rights reserved.
//

#import "TTSpecialViewCell.h"

@interface TTSpecialViewCell ()

@property (nonatomic, strong) UIImageView *pictureView;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *timeLabel;

@end

@implementation TTSpecialViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self setupSubviews];
        
    }
    return self;
}

- (void)setModel:(TTActivityModel *)model
{
    _model = model;
    [self.pictureView sd_setImageWithURL:[NSURL URLWithString:model.CoverImg] placeholderImage:nil options:SDWebImageRetryFailed];
    self.titleLabel.text = model.Name;
//    self.timeLabel.text = model.BeginTime;
    
}

- (void)setupSubviews
{
    _pictureView = [[UIImageView alloc] init];
    _pictureView.contentMode = UIViewContentModeScaleAspectFill;
    _pictureView.layer.cornerRadius = 15;
    _pictureView.layer.masksToBounds = YES;
    [self.contentView addSubview:_pictureView];
    [_pictureView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self);
        make.top.left.equalTo(self).mas_offset(12);
        make.right.equalTo(self.mas_right).mas_offset(-12);
    }];
    
    _titleLabel = [UILabel labelWithTitle:@"" color:UIColor.whiteColor font:[UIFont systemFontOfSize:16 weight:UIFontWeightMedium]];
    [self.contentView addSubview:_titleLabel];
    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).mas_offset(27);
        make.bottom.equalTo(self).mas_offset(-15);
    }];
    
    _timeLabel = [UILabel labelWithTitle:@"" color:UIColor.whiteColor font:[UIFont systemFontOfSize:13 weight:UIFontWeightMedium]];
    [self.contentView addSubview:_timeLabel];
    [_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.mas_right).mas_offset(-27);
        make.bottom.equalTo(self.titleLabel);
    }];
    
}

@end
